import {createRouter, createWebHistory} from 'vue-router'
import Layout from '@/layout/index.vue'
import {courseRouter} from "@/router/module/courseRouter.js";
import {educationRouter} from "@/router/module/educationRouter.js";
import {studentRouter} from "@/router/module/studentRouter.js";
import {systemRouter} from "@/router/module/systemRouter.js";

const router = createRouter({
  history: createWebHistory(import.meta.env.BASE_URL),
  routes: [
    {
      path: '/login',
      component: () => import('@/views/login/index.vue'),
      meta: { hidden: true }
    },
    {
      path: '/404',
      component: () => import('@/views/404.vue'),
      meta: { hidden: true }
    },
    {
      path: '/',
      component: Layout,
      redirect: '/dashboard',
      children: [
        {
          path: '/dashboard',
          name: 'Dashboard',
          component: () => import('@/views/dashboard/index.vue'),
          meta: { title: '首页', icon: 'House' }
        },
        ...courseRouter,
          educationRouter,
          studentRouter,
          systemRouter
      ]
    },
    {
      path: '/:pathMatch(.*)*',
      redirect: '/404',
      meta: { hidden: true }
    }
  ],
})

export default router
